<template>
  <div class="contactMe">
    <Title title="联系我" :show="show"></Title>
    <div class="content">
      <div class="title">
        <span v-for="(item, index) in title" :key="index" :style="{color: item.color}">{{ item.name }}</span>
      </div>
      <div class="text">
        <p v-for="(item, index) in text" :key="index">{{ item }}</p>
      </div>
      <div class="icon">
        <a :href="item.href" :target="[item.href === 'javascript:;' ? '_self' : '_balnk']" v-for="(item, index) in icon" :key="index" :class="['iconfont', `icon-${item.class}`]">
          <span :class="[item.img !== '' ? 'img' : 'text']" :style="{backgroundImage: `url(${item.img})`}">{{ item.img === '' ? item.class : '' }}</span>
        </a>
      </div>
    </div>
    <div class="bottom">
      <a href="http://beian.miit.gov.cn">赣ICP备20001402号</a>
    </div>
  </div>
</template>

<script>
import Title from '../title/title'

import { mapState } from 'vuex'

export default {
  name: 'contactMe',
  data () {
    return {
      show: false
    }
  },
  computed: {
    ...mapState(['title', 'text', 'icon'])
  },
  components: {
    Title
  }
}
</script>

<style lang="less" scoped>
.contactMe {
  width: 100%;
  height: 100%;
  padding: 50px 0 30px;
  position: relative;
  .content {
    display: flex;
    align-items: center;
    flex-direction: column;
    .title {
      width: 100%;
      max-width: 400px;
      display: flex;
      justify-content: space-around;
      padding: 20px 0;
      span {
        font-size: 1.4rem;
      }
    }
    .text {
      padding: 20px 0;
      p {
        padding-top: 20px;
        font-size: 1rem;
        text-align: center;
        color: #212529;
      }
    }
    .icon {
      padding: 20px 0;
      a {
        font-size: 1.4rem;
        color: #212529;
        text-decoration: none;
        padding: 5px;
        border-radius: 50%;
        display: flex;
        float: left;
        margin-right: 30px;
        justify-content: center;
        align-items: center;
        border: 1px solid #212529;
        cursor: pointer;
        position: relative;
        &:last-child {
          margin-right: 0;
        }
        &:hover {
          span {
            display: block;
          }
        }
        span {
          transition: all 1s;
          position: absolute;
          bottom: 50px;
          left: 50%;
          transform: translateX(-50%);
          display: none;
          &::after {
            content: '';
            position: absolute;
            bottom: 0;
            z-index: -1;
            display: block;
            left: 50%;
            transform: translateX(-50%) translateY(100%);
            width: 0;
            height: 0;
            border: 10px solid transparent;
            border-top: 10px solid #f63;
          }
        }
        .img {
          width: 200px;
          height: 200px;
          background-size: 100%;
          border: 2px solid #f63;
        }
        .text {
          background-color: #f63;
          padding: 5px;
          border-radius: 4px;
          color: '#212529';
          font-size: .9rem;
        }
      }
    }
  }
  .bottom {
    width: 100%;
    position: absolute;
    bottom: 0;
    display: flex;
    justify-content: center;
    a {
      color: #212529;
      padding: 5px 0;
    }
  }
}
</style>
